package org.project.d.starter.network;

import org.project.d.starter.network.properties.ProjectNetworkProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;

/**
 * @author lin
 * @version V1.0
 * @description
 * @date 2020/9/22 3:20 下午
 */
@ConditionalOnProperty(name = "project.d.network.enable",matchIfMissing = true)
@EnableConfigurationProperties(ProjectNetworkProperties.class)
public class ProjectNetworkAutoConfiguration {
    @Bean
    public ProjectNetworkAutoRegister projectNetworkAutoRegister(ProjectNetworkProperties projectNetworkProperties, ApplicationContext applicationContext){
        ProjectNetworkAutoRegister projectNetworkAutoRegister = new ProjectNetworkAutoRegister(projectNetworkProperties, applicationContext);
        projectNetworkAutoRegister.regist();
        return projectNetworkAutoRegister;
    }
}
